﻿@model ArticleControllerModel.Index
<div class="page">
    <div class="pageHeader">
        <form id="pagerForm" onsubmit="return navTabSearch(this);" action="/game/article"
        method="post">
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label>
                        游 戏：
                    </label>
                    <select name="GameId">
                        <option value="" @(Model.GameId == 0 ? "selected=selected" : string.Empty)>请选择游戏</option>
                        @foreach (var o in Model.Games)
                        {
                            <option value ="@(o.Id)" @(Model.GameId == o.Id ? "selected=selected" : string.Empty)>@(o.Name)</option>
                        }
                    </select>
                </li>
                <li>
                    <label>
                        分 类：</label>
                    <select name="Category">
                        <option value="" @(!Model.Category.HasValue ? "selected=selected" : string.Empty)>请选择分类</option>
                        @foreach (var o in GameArticle.CategoryDic)
                        {
                            <option value ="@(o.Key)" @(Model.Category == o.Key ? "selected=selected" : string.Empty)>@(o.Value)</option>
                        }
                    </select>
                </li>
                <li>
                    <label>
                        状 态：</label>
                    <select name="Status">
                        <option value="" @(!Model.Status.HasValue ? "selected=selected" : string.Empty)>请选择状态</option>
                        @foreach (var o in GameArticle.StatusDic)
                        {
                            <option value ="@(o.Key)" @(Model.Status == o.Key ? "selected=selected" : string.Empty)>@(o.Value)</option>
                        }
                    </select>
                </li>
                <li>
                    <label>
                        Id：
                    </label>
                    <input type="text" name="Id" value="@(Model.Id)" />
                </li>
                <li>
                    <label>
                        添加日期：
                    </label>
                    <input type="text" name="Date" value="@(Model.Date.ToString("yyyy-MM-dd", string.Empty))" class="date" readonly="readonly"/>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">
                                    检索</button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        </form>
    </div>
    <div>
        <div class="panelBar">
            <ul class="toolBar">
                <li><a class="add" href="/game/article/detail" target="dialog" title="添加游戏文章" mask="true"
                    width="865" height="630" onclick=" javascript:void(0); " rel="/game/article/detail">
                    <span>添 加</span></a></li>
                <li><a class="add" href="/game/article/detail/{param}" target="dialog" title="编辑游戏文章"
                    mask="true" width="865" height="630" onclick=" javascript:void(0); " rel="/game/article/detail">
                    <span>编 辑</span></a></li>
            </ul>
        </div>
        <table class="table" layouth="138" width="100%">
            <thead>
                <tr>
                    <th width="50">
                        Id
                    </th>
                    <th width="60">
                        ParentId
                    </th>
                    <th width="100">
                        分 类
                    </th>
                    <th>
                        标 题
                    </th>
                    <th width="180">
                        子标题
                    </th>
                    <th width="180">
                        标 识
                    </th>
                    <th width="80">
                        状 态
                    </th>
                    <th width="160">
                        添加时间
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var o in Model.Articles)
                {
                    <tr target="param" rel="@o.Id">
                        <td>@o.Id
                        </td>
                        <td>@o.ParentId
                        </td>
                        <td>@(GameArticle.CategoryDic.FirstOrDefault(x => x.Key == o.Category).Value)
                        </td>
                        <td>@o.Title
                        </td>
                        <td>@o.SubTitle
                        </td>
                        <td>
                            @foreach (var x in GameArticle.FlagDic)
                            {
                                if ((o.Flag & x.Key) == x.Key)
                                {
                                <span style="padding: 0 5px;">@x.Value </span>
                                }
                            }
                        </td>
                        <td>@(GameArticle.StatusDic.FirstOrDefault(x => x.Key == o.Status).Value)
                        </td>
                        <td>
                            @o.CreatedOn.ToString("yyy-MM-dd HH:mm:ss")
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
